import request from './request';

//登录注册1
export function useLoginApi() {
    return {
        //新的令牌
        refresh: (data: object) => {
            return request({
                url: '/newApi/pc/auth2/refresh',
                method: 'post',
                data,
            });
        },
    };
}

export const noTokenList = [
    '/newApi/pc/auth2/loginMobil',
    '/newApi/pc/auth2/registerEmail',
    '/newApi/pc/auth2/registerMobile',
    '/newApi/pc/auth2/registerEmail',
    '/newApi/pc/auth2/refresh',
]
//注册手机2
export const registerMobile = (data:object) => {
    return request({
        url: '/newApi/pc/auth2/registerMobile',
        method: 'post',
        data,
    });
}
//注册邮箱3
export const registerEmail = (data:object) => {
    return request({
        url: '/newApi/pc/auth2/registerEmail',
        method: 'post',
        data,
    });
}
//手机登录4
export const loginMobil = (data:object) => {
    return request({
        url: '/newApi/pc/auth2/loginMobil',
        method: 'post',
        data,
    });
}
//邮箱登录5
export const loginEmail = (data:object) => {
    return request({
        url: '/newApi/pc/auth2/loginEmail',
        method: 'post',
        data,
    });
}
//刷新token6
export const refresh = (data:object) => {
    return request({
        url: '/newApi/pc/auth2/refresh',
        method: 'post',
        data,
    });
}

//首页商品数据7
export const getIndexList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getIndexList',
        method: 'get',
        params: data
    })
}
//商品分类列表8
export const getCategoryList = (data: object) => {
    return request({
        url: '/newApi/pc/Category/list',
        method: 'get',
        params: data
    })
}

//获取广告位9
export const getAdList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getAdList',
        method: 'get',
        params:data
    })
}

//热卖榜单一级列表10
export const getRankingCategoryList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getRankingCategoryList',
        method: 'get',
        params:data
    })
}
//热卖二级榜单11
export const getRankingCategoryTitleList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getRankingCategoryTitleList',
        method: 'get',
        params:data
    })
}
//热卖三级榜单12
export const getRankingIndexList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getRankingIndexList',
        method: 'get',
        params:data
    })
}
//榜单列表13
export const getRankingList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getRankingList',
        method: 'get',
        params:data
    })
}
//商品详情14
export const getGoodsDetail = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getGoodInfo',
        method: 'get',
        params:data
    })
}
//获取商品规格15
export const getGoodsSkuAttribute = (data: any) => {
    return request({
        url: '/newApi/pc/goods/getGoodsSkuAttribute',
        method: 'get',
        params:data
    })
}
export const getGoodsSkuAttributeRaw = (data: any) => {
    return request({
        url: '/newApi/pc/goods/getGoodsSkuAttribute',
        method: 'get',
        params:data,
    })
}
//获取商品评论16
export const getGoodsComment = (data: object) => {
    return request({
        url: '/newApi/pc/goods/orderCommentList',
        method: 'get',
        params:data
    })
}

//vip活动专区列表17
export const getVipTopList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getVipList',
        method: 'get',
        params:data
    })
}


//商品图搜18
export const getSearchGoodsByImage = (data: object) => {
    return request({
        url: '/newApi/pc/goods/searchGoodsByImage',
        method: 'get',
        params:data
    })
}
//首页导航菜单19
export const getIndexMenu = (data: object) => {
    return request({
        url: '/newApi/pc/goods/getIndexMenu',
        method: 'get',
        params:data
    })
}
//活动专区列表20
export const getActivityGoodsList = (data: object) => {
    return request({
        url: '/newApi/pc/goods/activityGoodsList',
        method: 'get',
        params:data
    })
}
//购物车列表21
export const getShoppingcartList = (data: object) => {
    return request({
        url: '/newApi/pc/shoppingcart/getList',
        method: 'get',
        params:data
    })
}
//加入购物车，修改购物车规格
export const getShoppingcartSave = (data: object) => {
    return request({
        url: '/newApi/pc/shoppingcart/save',
        method: 'post',
        data
    })
}
//删除购物车
export const getShoppingcartDelete = (data: object) => {
    return request({
        url: '/newApi/pc/shoppingcart/delete',
        method: 'post',
        data
    })

}
//订单售后
export const postShoppingcartDelete = (data: object) => {
    return request({
        url: '/newApi/pc/shoppingcart/delete',
        method: 'post',
        data
    })
}

//订单列表
export const getOrderGetList = (params: object) => {
    return request({
        url: '/newApi/pc/order/getList',
        method: 'get',
        params
    })
}

/**
 * 订单详情
 * @param order_id 订单Id  
 * @returns 订单详情
 */
export const getOrderDetail = (order_id: number) => {
    return request({
        url: '/newApi/pc/order/getOne',
        method: 'get',
        params: { order_id }
    })
}
//订单列表
export const getUserInfoMy = () => {
    return request({
        url: '/newApi/pc/my',
        method: 'get',
    })
}

//订单售后
export const postGoodslikeGetlist = (data: object) => {
    return request({
        url: '/newApi/pc/goodslike/getlist',
        method: 'post',
        data
    })
}

//商品收藏列表
export const getGoodslikeAjaxDropDown = () => {
    return request({
        url: '/newApi/pc/goodslike/ajaxDropDown',
        method: 'get',
    })
}
//快速询价列表
export const getGoodspriceaskingList = (params:any) => {
    return request({
        url: '/newApi/pc/goodspriceasking/list',
        method: 'get',
        params
    })
}

// 俄罗斯城市列表
export const getRussiaCityList = (params:any) => {
    return request({
        url: '/newApi/pc/rucity/getAppList',
        method: 'get',
        params
    })
}
/**
 * 获取感兴趣品类
 */
export const getInterestedCategory = () => {
    return request({
        url: '/newApi/pc/my/getInterestedCategory',
        method: 'get',
    })
}
/**
 * 设置感兴趣品类
 */
export const setInterestedCategory = (category_ids: number[]) => {
    return request({
        url: '/newApi/pc/my/setInterestedCategory',
        method: 'post',
        data: {
            category_ids
        }
    })
}

/**
 * 修改个人信息
 */
export const uploadUserInfo = (data: any) => {
    return request({
        url: '/newApi/pc/my/change/info',
        method: 'put',
        data
    })
}

/**
 * 修改密码(短信方式)
 */
export const changePasswordByMobile = (data: any) => {
    return request({
        url: '/newApi/pc/my/changePasswordByMobile',
        method: 'post',
        data
    })
}

/**
 * 修改密码(旧密码方式)
 */
export const changePasswordByPassword = (data: any) => {
    return request({
        url: '/newApi/pc/my/changePasswordByPassword',
        method: 'post',
        data
    })
}